package com.hashmap;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HashMapTest {
    public static void main(String[] args) {
        HashMap<String,Integer> hashMap = new HashMap();
        hashMap.put("zhangsan",99);
        hashMap.put("lisi",88);
        hashMap.put("wangwu",77);
        hashMap.put("zhaoliu",78);

        Set<String> keySet = hashMap.keySet();
        for (String s : keySet) {
            System.out.println(s + "=" + hashMap.get(s));
        }

        for (Map.Entry<String, Integer> entry : hashMap.entrySet()) {
            System.out.println(entry.getKey() + "=" + entry.getValue());
        }
        System.out.println(hashMap.get("zhangsan"));
        System.out.println(hashMap.size());
        System.out.println(hashMap.containsKey("zhangsan"));
        System.out.println(hashMap.containsValue(99));
/*        hashMap.clear();
        System.out.println(hashMap.isEmpty());*/
        Integer zhangsan = hashMap.remove("zhangsan");
        System.out.println(zhangsan);
        System.out.println(hashMap);


    }
}
